package com.xteam.ecsystem.dao.Impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.xteam.ecsystem.dao.IClassifiedDao;
import com.xteam.ecsystem.entities.BaseGoodsGroup;
@Repository
@SuppressWarnings("unchecked")
/**
 * 分类菜单实现类
 */
public class ClassifiedDaoImpl implements IClassifiedDao {
	
	@Autowired
	private BaseDaoImpl baseDao;
	
	/**
	 * 
	 * 根据节点ID，获取兄弟节点及该节点的所有子节点
	 * @see com.xteam.ecsystem.dao.IClassifiedDao#getTreeNodeById(java.lang.String)
	 */
	@Override
	public List<?> getTreeNodeById(String treeid) {
		List list = new ArrayList();
		try{
			list = baseDao.queryListByProcedure("query_goods_group", BaseGoodsGroup.class, new Object[]{treeid});
		}catch (Exception e) {
		}
		return list;
	}
	
	/**
	 * 
	 * 获取所有节点
	 * @see com.xteam.ecsystem.dao.IClassifiedDao#getAllNodeById()
	 */
	@Override
	public List<?> getAllNodeById() {
		List list = new ArrayList();
		try{
			list = baseDao.findAll(BaseGoodsGroup.class);
		}catch (Exception e) {
		}
		return list;
	}

	/**
	 * 
	 * 获取节点路径（即节点的所有父节点）
	 * @see com.xteam.ecsystem.dao.IClassifiedDao#getNodePathById(java.lang.String)
	 */
	@Override
	public List<?> getNodePathById(String treeid) {
		List list = new ArrayList();
		try{
			list = baseDao.queryListByProcedure("query_group_path", BaseGoodsGroup.class, new Object[]{treeid});
		}catch (Exception e) {
		}
		return list;
	}

}
